import test_framework.test.unit.info.AssertEqualsInfo;
import test_framework.test.unit.TestCase;
import gugga.collections.ObjectSet;
import gugga.debug.Assertion;

/**
 * @author stefan
 */
class guggaLibTests.ObjectSetTest
		extends TestCase
{
	function ObjectSetTest() 
	{
		super();
	}
	
	function testComplex ()
	{
		var objSet : ObjectSet = new ObjectSet();
		
		var obj1 : Object = { name: "first" };
		var obj2 : Object = { name: "second" };
		var obj3 : Object = { name: "second" };
		
		objSet.addElement(obj1);
		objSet.addElement(obj2);
		
		assertTrue(
			"object set should contain obj1",
			objSet.containsElement(obj1)
		);
		
		assertTrue(
			"object set should contain obj1",
			objSet.containsElement(obj2)
		);
		
		assertFalse(
			"object set should not contain obj3",
			objSet.containsElement(obj3)
		);
	}
	
	function testGetAllElements ()
	{
		var objSet : ObjectSet = new ObjectSet();
		
		var obj1 : Object = { name: "first" };
		var obj2 : Object = { name: "second" };
		
		objSet.addElement(obj2);
		objSet.addElement(obj1);
		
		var setValues : Array = objSet.getAllElements();
		
		assertEquals(
			"element 0 of the array should be equal to obj1",
			setValues[0],
			obj1
		);
		
		assertEquals(
			"element 1 of the array should be equal to obj2",
			setValues[1],
			obj2
		);
		
		assertNotEquals(
			"element 1 of the array should not be equal to obj1",
			setValues[1],
			obj1
		);
	}		
}